home *** CD-ROM | disk | FTP | other *** search
- Path: gaia.ns.utk.edu!usenet
- From: DBA1.CAS.UTK.EDU@ (Mychal Boyd Manie)
- Newsgroups: comp.lang.rexx
- Subject: ValueSet Object in VX REXX
- Date: 3 Feb 1996 04:51:18 GMT
- Organization: UT Knoxville
- Distribution: WORLD
- Message-ID: <4eupk6$1v2@gaia.ns.utk.edu>
- Reply-To: manie@utk.edu
- NNTP-Posting-Host: dba1.cas.utk.edu
- X-Newsreader: IBM NewsReader/2 v1.9d - NLS
-
- Have you ever made a program that does some monitoring for some
- event (such as, network traffic patterns, lost connections, disk space exceeded)?
- Something you might want to see the status of at a glance. Sort of like the
- "little blinky lights" on modems or network cards. May be like a STOPLIGHT.
-
- The "valueset" object lets you do just this. This next segment is an extracted
- from a .VRT:
-
- BEGIN VRValueSet
- Border "0"
- ItemBorder "0"
- Rows "3"
- Columns "1"
- ItemType "RGB"
- ResizePicture "1"
- InitialList ";(100,0,0);(133,121,0);(0,100,0)"
- Height "2060"
- Left "241"
- Top "108"
- Width "735"
- Visible "1"
- TabStop "1"
- Enabled "1"
- EventList binary lines 0 checksum 0
- DoubleClick ""
- BorderColor "White"
- HiliteColor "<default>"
- TabGroup "0"
- ClipSiblings "0"
- TabIndex "25"
- Font "<default>"
- Click ""
- DragDrop ""
- GotFocus ""
- LostFocus ""
- KeyPress ""
- ForeColor "<default>"
- BackColor "Black"
- ContextMenu ""
- DragTarget "All"
- AllowDrag "0"
- DragStart ""
- DragIcon ""
- DragDiscard ""
- DragPrint ""
- Name "VS_1"
- UserData binary lines 0 checksum 0
- HelpText ""
- HelpTag ""
- HintText ""
- END
-
- The above is all the field values for an arbitrary (red,yellow,green) stoplight.
- The default colors are a 'dimmed' red,yellow,green.
-
- The next segment is a procedure that I call to individually set one of the lights.
-
- stop_light_part2:
- arg vs_label, item_number, color_value
- call VRSet vs_label, "Selected", item_number
- selected = vrget(vs_label, 'Selected')
- call VRMethod vs_label, "GetAttributes", "Values", "attrs."
- attrs.selected = color_value
- call vrmethod vs_label,"SetAttributes","Values","attrs."
- return
-
- This is the calling style for the procedure:
-
- /* NOTE: 'VS_1' is the object label/title, 1,2,3 is the item number in the list
- and the (x,y,z) is the RGB color values */
-
- call stop_light_part2 'VS_1', 1,"(255,0,0)" /* bright red on the first item */
- call stop_light_part2 'VS_1', 2,"(255,255,0)" /* bright yellow on the second item */
- call stop_light_part2 'VS_1', 3,"(0,255,0)" /* bright green on the third item */
-
- If this is a stop light, then we should probably dim the other two lights when
- we highlight one of them. So enter another procedure that accepts a color (ie,
- RED, GREEN, YELLOW) and sets all three lights/items.
-
- stop_light:
- arg color_ind
-
- if color_ind = 'RED' then do
- call stop_light_part2 'VS_1', 1,"(255,0,0)"
- call stop_light_part2 'VS_1', 2,"(133,121,0)"
- call stop_light_part2 'VS_1', 3,"(0,100,0)"
- end
-
- if color_ind = 'YELLOW' then do
- call stop_light_part2 'VS_1', 1,"(100,0,0)"
- call stop_light_part2 'VS_1', 2,"(255,255,0)"
- call stop_light_part2 'VS_1', 3,"(0,100,0)"
- end
-
- if color_ind = 'GREEN' then do
- call stop_light_part2 'VS_1', 1,"(100,0,0)"
- call stop_light_part2 'VS_1', 2,"(133,121,0)"
- call stop_light_part2 'VS_1', 3,"(0,255,0)"
- end
- return
-
- The next question might be, "do i have to reproduce this for multiple VS objects?"
- Not really. The stoplight example you might use once or so, but a simple
- on/off is more likely. For that you can mainly use the first routine
- (stop_light_part_2). Rename the procs if you like.
-
- And when calling, substitute your VS label/title (eg, 'VS_2') and the item#
- within the object (eg, 1,2,3) and your color scheme. And you shouldn't have
- to remember the color scheme, so....
-
- stop_light_part2_revised:
- arg vs_label, item_number, color_name
-
- color_value = '(0,0,0)' /* black by default or bad value */
- if color_name = 'RED' then color_value = '(255,0,0)'
- if color_name = 'GREEN' then color_value = '(0,255,0)'
-
- call VRSet vs_label, "Selected", item_number
- selected = vrget(vs_label, 'Selected')
- call VRMethod vs_label, "GetAttributes", "Values", "attrs."
- attrs.selected = color_value
- call vrmethod vs_label,"SetAttributes","Values","attrs."
- return
-
- call stop_light_part2_revised 'VS_1', 1,"RED"
- call stop_light_part2_revised 'VS_1', 2,"GREEN"
-
- Hope you find a use for this. Send comments to the newsgrp or to
- me personally.
-
- Extra exercise: put the color scheme in a proc that translates
- all color words (eg, RED, GREEN, DULL_RED) to their respective
- RGB values.
-
- ----------------------- manie@utk.edu
- Mychal Boyd Manie (DBA) UT Knoxville (423)974-2398
- WARPed... Why? Because I have work to do (I hate rebooting).
-
-